import axios from 'axios'
import Cookies from 'js-cookie'
const service = axios.create({
  // 当执行 npm run dev  => .evn.development => /api => 跨域代理
  baseURL: process.env.VUE_APP_BASE_API, // npm  run dev  => /api npm run build =>  /prod-api
  timeout: 5000 // 设置超时时间
})
service.interceptors.request.use(
  config => {
    // 统一的去注入token
    config.headers['Authorization'] = `Bearer ${Cookies('GZYZ-MM')}`
    return config
  },
  error => {
    return Promise.reject(error)
  }
)
// 响应拦截器
service.interceptors.response.use()
export default service
